<?php
error_reporting(0);
include_once '../comm/config.php';
include '../comm/checkpostandget.php';
include 'check.php';
include_once '../comm/wjt.php';

$current=$_GET['cur']?$_GET['cur']:'infoset';

$sql="select * from ".$BIAOTOU."user where Id=".$_SESSION["dduserid"]."";
$rs = mysql_query($sql);
while ($row = mysql_fetch_array($rs)){
	 $password=$row["ddpassword"]; 
	 $zfb=$row["zfb"]; 
	 $tbusername=$row["tbusername"]; 
	 $email=$row["email"]; 
	 $mobile=$row["mobile"]; 
	 $qq=$row["qq"]; 
}	

$sql="select ortherwebname from ".$BIAOTOU."apilogin where dduserid=".$_SESSION["dduserid"];
$rs = mysql_query($sql);
while ($row = mysql_fetch_array($rs)){
	 $ortherwebname_arr[]=$row['ortherwebname'];
}


$tag="center";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>账户设置 - 用户中心</title>

<link href="../template/<?=MOBAN?>/css/style.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/layout.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/comm.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="../js/jquery.js"></script>
<style type="text/css">
<!--
.STYLE4 {color: #FF3300; font-weight: bold; }
.STYLE5 {color: #0099FF}
-->
</style>
<script language="javascript" type="text/javascript">	
function getLength(str) {
    var len = str.length;
    var reLen = 0;
    for (var i = 0; i < len; i++) {        
        if (str.charCodeAt(i) < 27 || str.charCodeAt(i) > 126) {
            // 全角    
            reLen += 2;
        } else {
            reLen++;
        }
    }
    return reLen;    
} 

function checkoldpass()
{
	var password=document.getElementById("oldpassword").value;
    	if(getLength(password)<6 || getLength(password)>50)
		{
			document.getElementById("ckoldpass").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>密码长度必须为 6 - 20 位</font>';
			return false;
		}
		else
		{
			document.getElementById("ckoldpass").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>密码填写原正确</font>';
			return true;
		}
}    

function checkemail()
{
		var str = document.getElementById("email").value;    
        if(str.length!=0)
		{    
			reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;    
			if(!reg.test(str))
			{    
				document.getElementById("ckemail").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>电子邮件格式填写错误，请检查</font>';
				return false;
			}
			else
			{
				document.getElementById("ckemail").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>电子邮件格式正确</font>';
				return true;
			}
		}
		else
		{
				document.getElementById("ckemail").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写电子邮件</font>';
				return false;
		}
} 
function checkzfb()
{
		var str = document.getElementById("zfb").value;    
        if(str.length!=0)
		{    
			document.getElementById("ckzfb").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>支付宝填写正确</font>';
			return true;
		}
		else
		{
			document.getElementById("ckzfb").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写支付宝</font>';
			return false;
		}
}
function checkname()
{
		var str = document.getElementById("tbusername").value;    
        if(str.length==0)
		{    
			document.getElementById("cktbusername").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写真实姓名，提现时核对用</font>';
			return false;
		}
		else{
			document.getElementById("cktbusername").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>姓名已填写</font>';
		    return true;
		}
		
} 
function checkall()
{
	if(checkoldpass()&&checkzfb()&&checkname())
	{
		return true;
		
	}
	else
	{
		return false;
		
	}
}
$(function(){
    $('.title ul li a').click(function(){
	    $('.title ul li a').removeClass('current');
		$(this).addClass('current');
		$('#infoset,#binding').hide();
		$('#'+$(this).attr('value')).show();
	});
})
</script>
</head>
<?php
$modtag="mng";
include("../template/".MOBAN."/header_user.tpl.php");
?>


<div class="layout_body">

  <div class="uInfoTop">
     <div class="break"><a href="javascript:void();" onclick="javascript:window.history.back();"><img src="../template/<?=MOBAN?>/images/back.gif" width="29" height="30" border="0" /></a></div>
     <div class="username usernamefont"><?=$_SESSION["duoduouser"]?></div>
     <div class="userstate"><a class="ustatefont" href="exit.php">退出</a></div>
  </div>
  <div class="usertopline"></div>

  <div class="clears"></div>
  <div class="CreatL" style="width:160px">
    <ul>
      <li><a href="mingxilist.php?act=in">账户明细</a></li>
      <li><a href="avatar.php"> 头像设置</a></li>
      <li><a href="setpass.php">密码设置</a></li>
      <li class="UserSel"><a href="info.php">个人信息设置</a></li>
    </ul>
  </div>
  <div class="CreatR">
      <ul class="babydetail MarginB10">
        <li class="active"><a href="tradelist.php?act=taobao">个人信息设置</a></li>
      </ul>
      <div class="clears"></div>
      <div class=" clears"></div>
  </div> 
  <form id="infoset" name="form1" action="info_save.php" method="post" onsubmit="return checkall()" <?php if($current=='binding'){?> style="display:none" <?php }?>>
  <div class="userinfo">
     <div class="line">
        <div class="cp">真实姓名：</div> 	
        <div class="edit"><input type="text" name="tbusername" id="tbusername" onblur="checkname();"  value="<?php echo $tbusername?>" maxlength="50" <?php if ($tbusername!=""){ echo "disabled='disabled'";}?> class="mytxt" /></div>
        <div class="hint" id="cktbusername">提现转账时核对用，填写后不能修改</div>    
    </div>
    <div class="line">
        <div class="cp">支付宝账号：</div> 
     	<div class="edit"><input type="text"  name="zfb" id="zfb" onblur="checkzfb();"  value="<?php echo $zfb?>" <?php if ($zfb!=""){ echo "disabled='disabled'";}?> class="mytxt" /></div>
        <div class="hint" id="ckzfb">第一次设置后无法更改或找优优助手更改</div>  
     </div>  
     <div class="line">
        <div class="cp">手机号码：</div> 	
        <div class="edit"><input name="mobile" id="mobile" type="text" value="<?php echo $mobile?>" maxlength="50" class="mytxt" /></div>
        <!--<div class="hint" id="cknewpass">test</div> --> 
    </div>
    <div class="line">
        <div class="cp">联系QQ：</div> 
     	<div class="edit"><input type="text"  name="qq" id="qq"  value="<?php echo $qq?>" maxlength="50" class="mytxt" /></div>
        <!--<div class="hint" id="ckpass2">第一次设置后无法更改或找优优助手更改</div>-->  
     </div>  
     <div class="line">
        <div class="cp">密码：</div>
     	<div class="edit"><input type="password" name="oldpassword" id="oldpassword" onblur="checkoldpass();" maxlength="50" value="" class="mytxt" /></div>
 		<div class="hint" id="ckoldpass">修改信息请填写登录密码</div>    
     </div> 
     
     <div class="line" style="margin-top:20px">
       <input type="submit" value="修改密码" class="divbutton" style="height:40px;width:150px;margin-left:100px;display:inline" />
     </div>
  </div>
  </form>
</div>
 
<div class="lineclear" style="margin-top:50px"></div>
<?php
include("../template/".MOBAN."/footer.tpl.php");
?>
</body>
</html>
